package top.younote.cherry.schedule;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import top.younote.cherry.email.DailyCalendarAndWeather;
import top.younote.cherry.selenium.BaiduService;
import top.younote.cherry.selenium.WorldCupService;
import top.younote.cherry.service.IMailService;

/**
 * @Description: 每日提醒
 * @Author: duanluyao
 * @CreateTime: 2021/10/14 18:46:13
 */
@Component
public class DailySchedule {
    @Autowired
    JavaMailSender mailSender;
    @Autowired
    private IMailService iMailService;
    @Autowired
    private BaiduService baiduService;
    @Autowired
    private WorldCupService worldCupService;

    @Scheduled(cron = "0 0 6,12,18 * * ?")
    public void sendDailyBaiduRealtime() {
        String content = DailyCalendarAndWeather.dailyNews(baiduService.getBaiduRealtime());
        iMailService.sendHtmlMail("duanyu@martind.cn", "每日实时热搜", content);
//        baiduService.getBaiduRealtimeV2();
    }

    @Scheduled(cron = "0 */1 * * * ?")
    public void sendWordCup() {
//        worldCupService.sendChange();
    }
}
